package org.idea;

import cn.hutool.core.util.RandomUtil;

/**
 * @author 吴宇亮 on 2022/3/16 15:36
 */
public class ThreadAndAllBreakApplication {

    public static void main(String[] args) {
        ThreadTest thread1 = new ThreadTest();
        thread1.setName("线程A");
        thread1.start();

        ThreadTest thread2 = new ThreadTest();
        thread2.setName("线程B");
        thread2.start();

        ThreadTest thread3 = new ThreadTest();
        thread3.setName("线程C");
        thread3.start();
    }
}

class ThreadTest extends Thread {

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + ": 1");
        try {
            long millis = RandomUtil.randomLong(100, 500);
            System.out.println(Thread.currentThread().getName() + "睡眠: " + millis);
            Thread.sleep(millis);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(Thread.currentThread().getName() + ": 2");
        System.out.println(Thread.currentThread().getName() + ": 3");
        System.out.println(Thread.currentThread().getName() + ": 设置断点的前一行代码");
        System.out.println(Thread.currentThread().getName() + ": 4");
        System.out.println(Thread.currentThread().getName() + ": end");
    }
}